package com.heima.kafka.listener;

import com.alibaba.fastjson.JSON;
import com.heima.kafka.pojos.User;
import org.springframework.kafka.annotation.KafkaListener;
import org.springframework.stereotype.Component;

@Component
public class MsgListener {

    @KafkaListener(topics = {"hello-topic"})
    public void onMsg(String msg){
        System.out.println(msg);
    }


    @KafkaListener(topics = {"hello-topic-object"})
    public void onMsg1(String msg){
        User user = JSON.parseObject(msg, User.class);

        System.out.println(user);

    }
}
